package com.hp.TrimClient;

import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;

public class ContentDisposition {

	private Header _header;
	
	
	public ContentDisposition(Header header) {
		this._header = header;
	}

	public String getFileName() {
		HeaderElement[] helelms = _header.getElements();
		if (helelms.length > 0) {
		    HeaderElement helem = helelms[0];
		    if (helem.getName().equalsIgnoreCase("attachment")
		    	|| helem.getName().equalsIgnoreCase("inline")) {
		        NameValuePair nmv = helem.getParameterByName("filename");
		        if (nmv != null) {
		            return nmv.getValue();
		        }
		    }
		}
		return null;
	}

}
